package com.example.ixform.dao;


import com.example.ixform.dto.ChartData;
import com.example.ixform.entities.Production;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.CrudRepository;
import org.springframework.stereotype.Repository;

import java.util.List;

@Repository
public interface ProductionRepository extends CrudRepository<Production, Long> {
    @Override
    public List<Production> findAll();

   @Query(nativeQuery = true,value = "SELECT stage as label, COUNT(*) as value FROM production GROUP BY stage")
    List<ChartData> getProductionStatus();
}
